<template>
  <div class="user">
    <div class="user-data-box">
      <el-table :data="userData" ref="userData" class="user-data" height="100%">
        <el-table-column type="selection" width="55"> </el-table-column>
        <el-table-column label="id" width="55" prop="id"> </el-table-column>
        <el-table-column label="名字" prop="name"> </el-table-column>
      </el-table>
    </div>
  </div>
</template>
<script>
import { getUserInfoApi } from "../../api/user";
export default {
  data() {
    return {
      userData: [],
    };
  },
  methods: {
    changeAutoSelected() {
      this.$nextTick(() => {
        this.userData.forEach((row) => {
          this.$refs.userData.toggleRowSelection(row, row.selected);
        });
      });
    },
  },
  setup() {},
  mounted() {
    getUserInfoApi().then((response) => {
      this.userData = response.data;
      this.changeAutoSelected();
    });
  },
};
</script>
<style scoped>
.user {
  display: flex;
}
.userData {
}
.user-data-box{
  margin: 15px;
  overflow: hidden;
  flex: 1;
}
</style>
